package com.k8.rpc.invoke.invocation;

import com.k8.rpc.invoke.InvokeMode;

import java.lang.reflect.Type;
import java.util.Map;

public interface Invocation {

    String getInvocationKey();

    InvokeMode getInvokeMode();

    Type getReturnType();

    void setTemplate(Invocation invocation);

    Invocation getTemplate();

    /**
     * get method name.
     *
     * @return method name.
     * @serial
     */
    String getMethodName();


    /**
     * get parameter types.
     *
     * @return parameter types.
     * @serial
     */
    Class<?>[] getParameterTypes();

    /**
     * get parameter's signature, string representation of parameter types.
     *
     * @return parameter's signature
     */
    Object[] getArguments();

    /**
     * get arguments.
     *
     * @return arguments.
     * @serial
     */

    /**
     * get attachments.
     *
     * @return attachments.
     * @serial
     */
    Map<String, String> getAttachments();


    Map<String, Object> getObjectAttachments();


    Map<String, Object> copyObjectAttachments();


    void setAttachment(String key, Object value);


    void setObjectAttachmentIfAbsent(String key, Object value);

    /**
     * get attachment by key.
     *
     * @return attachment value.
     * @serial
     */
    String getAttachment(String key);


    Object getObjectAttachment(String key);


    /**
     * get attachment by key with default value.
     *
     * @return attachment value.
     * @serial
     */
    String getAttachment(String key, String defaultValue);


    Object getObjectAttachment(String key, Object defaultValue);
}
